<html>
  
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../style.css">
    <base target="_parent">
    <title data-trilium-title>Code blocks</title>
  </head>
  
  <body>
    <div class="content">
       <h1 data-trilium-h1>Code blocks</h1>

      <div class="ck-content">
        <p>Code blocks are useful to add short snippets of code blocks inside text
          notes. Depending on your preference, it's possible to enable or disable
          word wrapping for these code blocks.</p>
        <p>We added syntax highlighting to code blocks as well. When a code block
          is first created it will try to automatically determine the programming
          language, should that fail it is possible to manually adjust it. The color
          scheme for the syntax highlighting is adjustable in settings.&nbsp;</p><pre><code class="language-application-javascript-env-frontend">function helloWorld() {

	alert("Hello world");

}</code></pre>
        <p>For larger pieces of code it is better to use a code note, which uses
          a fully-fledged code editor (CodeMirror). For an example of a code note,
          see&nbsp;<a class="reference-link" href="../Scripting%20examples/Custom%20request%20handler.js">Custom request handler</a>.</p>
      </div>
    </div>
  </body>

</html>